{extend name='extra@admin/content'}
{block name="button"}
{/block}
{block name="content"}
<form onsubmit="return false;" data-auto="true" method="post">
    {if empty($list)}
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    {else}
    <input type="hidden" value="resort" name="action"/>
    <div id="print">
        <table class="layui-table" lay-skin="line" lay-size="sm">
            <thead>
                <tr>
                    <th colspan="9" style="font-size:17px;text-align: center;">
                      {$order.order_sn} -{if condition="$order.type eq 1"}购货{else /}生产{/if}- {$order.price} - {if condition="$order.receive_time eq ''"}未处理{/if}
                    </th>
                </tr>
            </thead>
            <thead>
                <tr>
                    <th colspan="9" style="font-size:17px;text-align: center;">
                    </th>
                </tr>
            </thead>
            <thead>
                <tr>
                    <th class='text-left nowrap'>原料</th>
                    <th class='text-left nowrap'>单位</th>
                    <th class='text-left nowrap'>订单类型</th>
                    {if condition="$order.type eq 1"}
                        <th class='text-left nowrap'>进货数量</th>
                    {else /}
                        <th class='text-left nowrap'>生产使用</th>
                    {/if}
                    {if condition="$order.type eq 1"}
                        <th class='text-left nowrap'>收货数量</th>
                    {else /}
                        <th class='text-left nowrap'>实际消耗</th>
                    {/if}
                    <th class='text-left nowrap'>差异数</th>
                    <th class='text-left nowrap'>原料单价</th>
                    <th class='text-left nowrap'>原料总价</th>
                    <th class='text-left nowrap'>收货时间</th>
                </tr>
            </thead>
            <tbody>
                {volist name='list' id='vo'}
                <tr>
                    <td class='text-left nowrap'>
                        {$vo.name}
                    </td>
                    <td class='text-left nowrap'>
                        {$vo.unit}
                    </td>
                    <td class='text-left nowrap'>
                        {if condition="$order.type eq 1"}
                            购货
                        {else /}
                            生产
                        {/if}
                    </td>
                    <td class='text-left nowrap'>
                        {$vo.del_num}
                    </td>
                    <td class='text-left nowrap'>
                        {if condition="$order.receive_time eq ''"}
                            暂未处理
                        {else /}
                            {$vo.res_num}
                        {/if}
                    </td>
                    <td class='text-left nowrap'>
                        {if condition="$order.receive_time eq ''"}
                            暂未处理
                        {else /}
                            {$vo.dif_num}
                        {/if}
                    </td>
                    <td class='text-left nowrap'>
                        {$vo.price}
                    </td>
                    <td class='text-left nowrap'>
                        {$vo.signal_price}
                    </td>
                    <td class='text-left nowrap'>
                        {if condition="$order.receive_time eq ''"}
                            暂未处理
                        {else /}
                            {$order.receive_time|date="Y-m-d H:i",###}
                        {/if}
                    </td>
                </tr>
                {/volist}
            </tbody>
        </table>
    </div>
    {/if}
    <div class="layui-form-item text-center">
        <button class="layui-btn" onclick="printpage(document.getElementById('print'));">打印</button>
    </div>
  <script>
      /**
       * 打印页面
       */
      function printpage(obj){
          var newWindow=window.open("打印窗口","_blank");
          var docStr = obj.innerHTML;
          newWindow.document.write(docStr);
          newWindow.document.close();
          newWindow.print();
          newWindow.close();
      }
  </script>
</form>
{/block}